
<div class="content">
  <h2 class="title">商品搜索</h2>
  <%= render :partial=>"/admin/products/search" , :locals=>{:url =>admin_products_path} %>
  <div class="inner">
    
    <table class="table">
      <tbody><tr>
          <th class="first">图片</th>
          <th><%= order_by_link([:sort=>:name] ,:text=>'种类') %></th>
          <th><%= order_by_link([:color=>:name] ,:text=>'颜色') %></th>
          <th><%= order_by_link(:price ,:text=>'价格') %></th>
          <th><%= order_by_link(:rank ,:text=>'等级') %></th>
          <th><%= order_by_link(:serial ,:text=>'编号') %></th>
          <th><%= order_by_link(:proved_serial ,:text=>'证书编号') %></th>
          <th class="last"> </th>
        </tr>
        <% @products.each do |product| %>
          <tr class="<%= cycle("even", "odd")%>">
            <td><%= link_to image_tag(product.try(:product_images).try(:first).try(:image).try(:url).to_s ,:size=>"120x90") , product_path(product)%></td>
            <td><%= product.sort.name %></td>
            <td><%= product.color.name %></td>
            <td><%= product.price %></td>
            <td><%=h Product::RANK[product.rank] %></td>
            <td><%= product.serial %></td>
            <td><%= product.proved_serial %></td>
            <td class="last"><%= link_to '详细', admin_product_path(product) %>|
              <%= link_to '编辑', edit_admin_product_path(product) %>|
              <%= link_to '删除', admin_product_path(product), :confirm => '确认删除?', :method => :delete %></td>
          </tr>
        <%end%>
    </tbody></table>
        <%= will_paginate @products  %>
  </div>
</div>                               


